IBM Hexadecimal Floating-point
   HOME

TheInfoList



OR:

Hexadecimal In mathematics and computing, the hexadecimal (also base-16 or simply hex) numeral system is a positional numeral system that represents numbers using a radix (base) of 16. Unlike the decimal system representing numbers using 10 symbols, hexa ...
floating point In computing, floating-point arithmetic (FP) is arithmetic that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can be ...
(now called HFP by IBM) is a format for encoding floating-point numbers first introduced on the IBM
System/360 The IBM System/360 (S/360) is a family of mainframe computer systems that was announced by IBM on April 7, 1964, and delivered between 1965 and 1978. It was the first family of computers designed to cover both commercial and scientific applica ...
computers, and supported on subsequent machines based on that architecture, as well as machines which were intended to be application-compatible with System/360. In comparison to
IEEE 754 The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point arithmetic established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE). The standard addressed many problems found i ...
floating point, the HFP format has a longer
significand The significand (also mantissa or coefficient, sometimes also argument, or ambiguously fraction or characteristic) is part of a number in scientific notation or in floating-point representation, consisting of its significant digits. Depending on ...
, and a shorter
exponent Exponentiation is a mathematical operation, written as , involving two numbers, the '' base'' and the ''exponent'' or ''power'' , and pronounced as " (raised) to the (power of) ". When is a positive integer, exponentiation corresponds to re ...
. All HFP formats have 7 bits of exponent with a
bias Bias is a disproportionate weight ''in favor of'' or ''against'' an idea or thing, usually in a way that is closed-minded, prejudicial, or unfair. Biases can be innate or learned. People may develop biases for or against an individual, a group, ...
of 64. The normalized range of representable numbers is from 16−65 to 1663 (approx. 5.39761 × 10−79 to 7.237005 × 1075). The number is represented as the following formula: (−1)sign × 0.significand × 16exponent−64.


Single-precision 32-bit

A
single-precision Single-precision floating-point format (sometimes called FP32 or float32) is a computer number format, usually occupying 32 bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point. A floatin ...
HFP number (called "short" by IBM) is stored in a 32-bit word: : In this format the initial bit is not suppressed, and the radix (hexadecimal) point is set to the left of the significand (fraction in IBM documentation and the figures). Since the base is 16, the exponent in this form is about twice as large as the equivalent in IEEE 754, in order to have similar exponent range in binary, 9 exponent bits would be required.


Example

Consider encoding the value −118.625 as an HFP single-precision floating-point value. The value is negative, so the sign bit is 1. The value 118.62510 in binary is 1110110.1012. This value is normalized by moving the radix point left four bits (one hexadecimal digit) at a time until the leftmost digit is zero, yielding 0.011101101012. The remaining rightmost digits are padded with zeros, yielding a 24-bit fraction of .0111 0110 1010 0000 0000 00002. The normalized value moved the radix point two hexadecimal digits to the left, yielding a multiplier and exponent of 16+2. A bias of +64 is added to the exponent (+2), yielding +66, which is 100 00102. Combining the sign, exponent plus bias, and normalized fraction produces this encoding: : In other words, the number represented is −0.76A00016 × 1666 − 64 = −0.4633789… × 16+2 = −118.625


Largest representable number

: The number represented is +0.FFFFFF16 × 16127 − 64 = (1 − 16−6) × 1663 ≈ +7.2370051 × 1075


Smallest positive normalized number

: The number represented is +0.116 × 160 − 64 = 16−1 × 16−64 ≈ +5.397605 × 10−79.


Zero

: Zero (0.0) is represented in normalized form as all zero bits, which is arithmetically the value +0.016 × 160 − 64 = +0 × 16−64 ≈ +0.000000 × 10−79 = 0. Given a fraction of all-bits zero, any combination of positive or negative sign bit and a non-zero biased exponent will yield a value arithmetically equal to zero. However, the normalized form generated for zero by CPU hardware is all-bits zero. This is true for all three floating-point precision formats. Addition or subtraction with other exponent values can lose precision in the result.


Precision issues

Since the base is 16, there can be up to three leading zero bits in the binary significand. That means when the number is converted into binary, there can be as few as 21 bits of precision. Because of the "wobbling precision" effect, this can cause some calculations to be very inaccurate. This has caused considerable criticism. A good example of the inaccuracy is representation of decimal value 0.1. It has no exact binary or hexadecimal representation. In hexadecimal format, it is represented as 0.19999999...16 or 0.0001 1001 1001 1001 1001 1001 1001...2, that is: : This has only 21 bits, whereas the binary version has 24 bits of precision. Six hexadecimal digits of precision is roughly equivalent to six decimal digits (i.e. (6 − 1) log10(16) ≈ 6.02). A conversion of single precision hexadecimal float to decimal string would require at least 9 significant digits (i.e. 6 log10(16) + 1 ≈ 8.22) in order to convert back to the same hexadecimal float value.


Double-precision 64-bit

The
double-precision Double-precision floating-point format (sometimes called FP64 or float64) is a floating-point number format, usually occupying 64 bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point. Flo ...
HFP format (called "long" by IBM) is the same as the "short" format except that the fraction field is wider and the double-precision number is stored in a double word (8 bytes): : The exponent for this format covers only about a quarter of the range as the corresponding IEEE binary format. 14 hexadecimal digits of precision is roughly equivalent to 17 decimal digits. A conversion of double precision hexadecimal float to decimal string would require at least 18 significant digits in order to convert back to the same hexadecimal float value.


Extended-precision 128-bit

Called extended-precision by IBM, a quadruple-precision HFP format was added to the System/370 series and was available on some S/360 models (S/360-85, -195, and others by special request or simulated by OS software). The extended-precision fraction field is wider, and the extended-precision number is stored as two double words (16 bytes): : 28 hexadecimal digits of precision is roughly equivalent to 32 decimal digits. A conversion of extended precision HFP to decimal string would require at least 35 significant digits in order to convert back to the same HFP value. The stored exponent in the low-order part is 14 less than the high-order part, unless this would be less than zero.


Arithmetic operations

Available arithmetic operations are add and subtract, both normalized and unnormalized, and compare. Prenormalization is done based on the exponent difference. Multiply and divide prenormalize unnormalized values, and truncate the result after one guard digit. There is a halve operation to simplify dividing by two. Starting in ESA/390, there is a square root operation. All operations have one hexadecimal guard digit to avoid precision loss. Most arithmetic operations truncate like simple pocket calculators. Therefore, 1 − 16−8 = 1. In this case, the result is rounded away from zero.


IEEE 754 on IBM mainframes

Starting with the
S/390 The IBM System/390 is a discontinued mainframe product family implementing the ESA/390, the fifth generation of the System/360 instruction set architecture. The first computers to use the ESA/390 were the Enterprise System/9000 (ES/90 ...
G5 in 1998, IBM mainframes have also included IEEE binary floating-point units which conform to the IEEE 754 Standard for Floating-Point Arithmetic. IEEE decimal floating-point was added to
IBM System z9 IBM System z9 is a line of IBM mainframe computers. The first models were available on September 16, 2005. The System z9 also marks the end of the previously used eServer zSeries naming convention. It was also the last mainframe compute ...
GA2 in 2007 using millicode and in 2008 to the
IBM System z10 IBM System z10 is a line of IBM mainframes. The z10 Enterprise Class (EC) was announced on February 26, 2008. On October 21, 2008, IBM announced the z10 Business Class (BC), a scaled-down version of the z10 EC. The System z10 represents the ...
in hardware. Modern IBM mainframes support three floating-point radices with 3 hexadecimal (HFP) formats, 3 binary (BFP) formats, and 3 decimal (DFP) formats. There are two floating-point units per core; one supporting HFP and BFP, and one supporting DFP; there is one register file, FPRs, which holds all 3 formats. Starting with the z13 in 2015, processors have added a vector facility that includes 32 vector registers, each 128 bits wide; a vector register can contain two 64-bit or four 32-bit floating-point numbers.z/Architecture Principles of Operation
/ref> The traditional 16 floating-point registers are overlaid on the new vector registers so some data can be manipulated with traditional floating-point instructions or with the newer vector instructions.


Special uses

The IBM HFP format is used in: * SAS 5 Transport files (.XPT) as required by the
Food and Drug Administration The United States Food and Drug Administration (FDA or US FDA) is a List of United States federal agencies, federal agency of the United States Department of Health and Human Services, Department of Health and Human Services. The FDA is respon ...
(FDA) for New Drug Application (NDA) study submissions, *
GRIB GRIB (GRIdded Binary or General Regularly-distributed Information in Binary form) is a concise data format commonly used in meteorology to store historical and forecast weather data. It is standardized by the World Meteorological Organization's C ...
(GRIdded Binary) data files to exchange the output of weather prediction models (IEEE
single-precision floating-point format Single-precision floating-point format (sometimes called FP32 or float32) is a computer number format, usually occupying 32 bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point. A floating- ...
in current version), * GDS II (Graphic Database System II) format files (
OASIS In ecology, an oasis (; ) is a fertile area of a desert or semi-desert environment'ksar''with its surrounding feeding source, the palm grove, within a relational and circulatory nomadic system.” The location of oases has been of critical imp ...
is the replacement), and * SEG Y (Society of Exploration Geophysicists Y) format files (IEEE single-precision floating-point was added to the format in 2002). As IBM is the only remaining provider of hardware using the HFP format, and as the only IBM machines that support that format are their mainframes, few file formats require it. One exception is the SAS 5 Transport file format, which the FDA requires; in that format, "All floating-point numbers in the file are stored using the IBM mainframe representation. ..Most platforms use the IEEE representation for floating-point numbers. ..To assist you in reading and/or writing transport files, we are providing routines to convert from IEEE representation (either big endian or little endian) to transport representation and back again." Code for IBM's format is also available under
LGPLv2.1 The GNU Lesser General Public License (LGPL) is a free-software license published by the Free Software Foundation (FSF). The license allows developers and companies to use and integrate a software component released under the LGPL into their own ...
.


Systems that use the IBM floating-point format

*
IBM System/360 The IBM System/360 (S/360) is a family of mainframe computer systems that was announced by IBM on April 7, 1964, and delivered between 1965 and 1978. It was the first family of computers designed to cover both commercial and scientific applica ...
and successors *
RCA Spectra 70 The RCA Spectra 70 was a line of electronic data processing (EDP) equipment manufactured by the Radio Corporation of America’s computer division beginning in April 1965. The Spectra 70 line included several CPU models, various configurations ...
*
English Electric System 4 The English Electric (later ICL) System 4 was a mainframe computer announced in 1965. It was derived from the RCA Spectra 70 range, itself a variant of the IBM System 360 The IBM System/360 (S/360) is a family of mainframe computer syst ...
*
GEC 4000 series The GEC 4000 was a series of 16/ 32-bit minicomputers produced by GEC Computers Ltd in the United Kingdom during the 1970s, 1980s and early 1990s. History GEC Computers was formed in 1968 as a business unit of the GEC conglomerate. It ...
minicomputers *
Interdata Interdata, Inc., was a computer company, founded in 1966 by a former Electronic Associates engineer, Daniel Sinnott, and was based in Oceanport, New Jersey. The company produced a line of 16- and 32-bit minicomputers that were loosely based on t ...
16-bit and 32-bit computers *
SDS Sigma series The SDS Sigma series is a series of third generation computers that were introduced by Scientific Data Systems of the United States in 1966. The first machines in the series are the 16-bit Sigma 2 and the 32-bit Sigma 7; the Sigma 7 was the firs ...
*
Data General Data General Corporation was one of the first minicomputer firms of the late 1960s. Three of the four founders were former employees of Digital Equipment Corporation (DEC). Their first product, 1969's Data General Nova, was a 16-bit minicomputer ...
minicomputers *
ICL 2900 Series The ICL 2900 Series was a range of mainframe computer, mainframe computer systems announced by the British manufacturer International Computers Limited, ICL on 9 October 1974. The company had started development under the name "New Range" immedi ...
computers *
Siemens Siemens AG ( ) is a German multinational conglomerate corporation and the largest industrial manufacturing company in Europe headquartered in Munich with branch offices abroad. The principal divisions of the corporation are ''Industry'', '' ...
7.700 and 7.500 series mainframes and successors


See also

* IEEE 754 Standard for Floating-Point Arithmetic *
Microsoft Binary Format In computing, Microsoft Binary Format (MBF) is a format for floating-point numbers which was used in Microsoft's BASIC language products, including MBASIC, GW-BASIC and QuickBASIC prior to version 4.00. There are two main versions of the format ...


References


Further reading

* * * Harding, L. J. (1966), "Idiosyncrasies of System/360 Floating-Point",
Proceedings of SHARE 27, August 8–12, 1966
', Presented at SHARE XXVII, Toronto, Canada * Harding, L. J. (1966), "Modifications of System/360 Floating Point",
SHARE Secretary Distribution
', pp. 11–27, SSD 157, C4470 * * * {{DEFAULTSORT:IBM Floating Point Architecture Computer arithmetic Floating Point Architecture Floating point Floating point types